package com.itzhoun;

import java.sql.Date;

/**
 * @author 周楠
 * @Date 2023/01/15/上午 10:52
 */
public class Decorator extends Drink{

    //这是采用抽象装饰类

    /**
     * 采用聚合的方式
     */
    private Drink drink;

    public Decorator(Drink drink){
        this.drink = drink;
    }

    @Override
    public String getDesc() {
        System.out.println(super.getDesc() + "&&" + drink.getDesc());
        return super.getDesc() + "&&" + drink.getDesc();
    }

    @Override
    public float cost() {
        return super.getPrice() + drink.cost();
    }
}
